package com.ludomancy.archeologyrpg.entities;

import java.awt.Graphics;
import java.awt.Point;

import com.ludomancy.archeologyrpg.GameTheme;
import com.ludomancy.archeologyrpg.Entity;
import com.ludomancy.archeologyrpg.Game;
import com.ludomancy.gamelib.Utils;

public class Rocket extends Entity
{
	public int maxOxygenTime = Game.discretize(30000);
	public int oxygenTime = maxOxygenTime;

	public Rocket(Point p)
	{
		super(p);
	}
	
	public void addOxygen(int percentage)
	{
		oxygenTime += percentage * maxOxygenTime / 100;
		oxygenTime = Math.min(maxOxygenTime, oxygenTime);
	}

	public void paint(Graphics g, int x, int y)
	{
		paintDefaultIcon(g, ROCKET, x, y);
	}

	public void paintInfo(Graphics g)
	{
		g.setColor(GameTheme.theme.getDefaultTextColor());
		g.setFont(GameTheme.theme.tinyFont);
		int oxyPer = (oxygenTime * 100)/maxOxygenTime;
		Utils.drawString(g, "O2 "+oxyPer+"%", px, py+Game.ENTITY_TILE_SIZE, Utils.ANCHOR_HCENTER|Utils.ANCHOR_BOTTOM);
	}

	public void update(boolean running, boolean activated)
	{
		if(running)
		{
			oxygenTime--;
			if(oxygenTime == 0)
			{
				// game lost
				System.out.println("game time over!");
			}
		}
	}

	public String getActionVerb()
	{
		return null;
	}

}
